import axios from 'axios'

const actions = {
	async jia({commit}){
		try {
			const result = await axios.get('https://api.uixsj.cn/hitokoto/get?type=soup')
			commit('JIA',result.data)
		} catch (error) {
			console.log('@',error.message)
		}
	},
}
const mutations = {
	JIA(state,news){
		state.list.unshift(news)
	},
}
const state = {
	list:[
		'震惊！张三竟然和自己的铁哥们做出了这种事！'
	]
}
const getters = {
	total(state){
		return state.list.length
	},
}

export default {
	namespaced:true,
	actions,
	mutations,
	state,
	getters
}